--
-- Author: ping.wang
-- Date: 2018-09-07 11:23:05
--
-- DynastyHistoryView
-- 光辉历史弹出界面
local NewguildIconRender = import(".renders.NewguildIconRender")
local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.DynastyHistoryScene

function ClassRef:init()
    self._ui.Button_close:addClickEventListener(function()
        self:closeView(false)
    end)
    self._ui["Panel/Button_close/name"]:setString(L("text_10200017"))
    local gloryData = self._data
    local history = GD:getHistoryEventById(gloryData.id)
    if gloryData and history then
        self._ui.tlt:setString(L(history.forceeventName))
        self._ui.tips_1:setString(L(history.eventName))

        local gt = HistoryManager:transTime(gloryData.finishTime)
        self._ui.text:setString(HistoryManager:transDesc(L(history.text),gloryData.params,gt.y))
        if history.forcePicture then
            self._ui.img:loadTexture("art/history/"..history.forcePicture..".png")
        end
    end

    self._guildIconRender = NewguildIconRender.create( self._ui.guild )
end

function ClassRef:setGuildInfo(guildInfo)
    self._guildIconRender:setData(guildInfo:getGuildIcon())
end

return ClassRef
